<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <style>
        body {
            height: 4000px;
        }

        .header {
            /* 定位以后，会脱离文档流不再占位，也不再继承父元素的宽度 */
            width: 100%;

            height: 100px;
            /* background-color: rgb(0 0 0 / 50%); */

            /* a alpha 透明度  0-1之间  也可以写百分比 */
            background-color: rgba(0, 0, 0, 50%);

            position: fixed;
            left: 0;
            top: 0;
        }

        .box {
            height: 150px;
            background-color: #f00;
            /* 把上面盒子的定位给挤下来 */
            margin-top: 150px;
        }
    </style>
</head>

<body>

    <div class="header"></div>

    <div class="box"></div>

</body>

</html>